/******************************************************************************************
 * Import
 ******************************************************************************************/
import _ from 'lodash';
import React, {Component} from 'react';
import { TouchableOpacity} from 'react-native';
import Design from '../../../../design';
import Config from '../../../../config';
import ScreenBase from '../../../../library/base/screen';
import { Toast } from 'antd-mobile-rn';
import { Text } from 'native-base';
// import SplashScreen from 'react-native-splash-screen';
import {
    CAround, CBetween, CCenter, CColumn, CHand, CItemX, CItemY, CLine, CRow, CWrap, 
    CIcon, CImage, CSvg, CText,
    CContent, CFloat, CFooter, CHeader, CPage, CSide, 
    CEmpty, CError, CFail, CSkeleton, 
    CLabel, CButton
} from '../../../../library/comp';
import {
    HttpText, HttpHesq
} from '../../../../library/func';

// svg
import Licon from '../../../../library/comp/project/icon';


/******************************************************************************************
 * Screen
 ******************************************************************************************/
export default class ProductList extends ScreenBase {
    constructor(props) {
        super(props);
        this.state = {}
    }

    toToast(){
        Toast.info('跳转至详情')
    }
    
    // 总render
    render() {
        return(
            <CColumn y='top'>
                {this.props.data.map((item,index) => {
                    return (
                        <TouchableOpacity onPress={_=>this.toToast()}>
                            <CItemX bg='#fff' mb='20' mx='20' ra='16' pa='16' style={{width:'100%'}}>
                                <CHand w='160' h='180' x='center' y='center'>
                                    <CImage
                                        style={{width: 80, height: 80}}
                                        source={{uri:item.object.set_image_small}}
                                    />
                                </CHand>
                                <CColumn y="center" mt="5" px='10'>
                                    <Text style={{flexWrap: "wrap",color:'#333',fontSize:12,fontWeight:'bold',marginLeft:5,marginRight:5}}>{item.set_name}</Text>
                                    <CText bg='#fee0e0' py='1' px='5' ra='100' size='18' mt='10' ml='10' color='#f92530'>促销价</CText>
                                    <CLine y='bottom' mt='8' ml='10'>
                                        <CText size='27'>￥{item.set_price}</CText>
                                        {/* {
                                                this.props.isvip == 1 ?
                                                    (
                                                        <CHand ml='32'>
                                                            <CText color='#c72e24' size='34'>赚</CText>
                                                            <CText color='#c72e24' size='36'>￥</CText>
                                                            <CText color='#c72e24' size='36'>{Math.floor(this.props.data.set_price*this.props.data.set_commission_percent)/100}</CText>
                                                        </CHand>
                                                    )
                                                    :
                                                    ( */}
                                                        <CText size='22' ml='10' color='#999'  style={{textDecorationLine: 'line-through'}}>￥123</CText>
                                                    {/* )
                                            } */}
                                    </CLine>
                                    <CText ml='10' mt="10" size='18' color='#999'>销量 {item.count_sale}</CText>
                                </CColumn>
                            </CItemX>
                        </TouchableOpacity>
                    )
                })}
            </CColumn>
        )
    }
}